import java.awt.*;
public class MenuDemo extends Frame
{ public static void main(String args[])
{ MenuDemo m = new MenuDemo();
m.setVisible(true);
MenuBar mbar = new MenuBar();
m.setMenuBar(mbar);
// Creating Menus
Menu fileMenu = new Menu("File");
Menu editMenu = new Menu("Edit");
// Adding Menus to Menubar
mbar.add(fileMenu);
mbar.add(editMenu);
// Creating MenuItems for file menu.
MenuItem new1=new MenuItem("New");
MenuItem open1=new MenuItem("open");
// Adding these to the FileMenu
fileMenu.add(new1);
fileMenu.add(open1);
}}